# -*- coding: utf-8 -*-
"""
Created on 2022
@author: GLTS
"""
import base64
import tkinter as tk
from Icon.favicon import img as favicon
import os


def fy():
    pass


def weather():
    pass


def setting():
    print('setting')


def help():
    print('help')


def update():
    import UpdateTool


def about():
    window_about = tk.Toplevel()
    # window_about = tk.Tk()
    window_about.title('关于')
    window_about.geometry('370x190')
    window_about.geometry('+507+300')

    tk.Label(window_about, text='本程序由 804班 朱德文 制作', font=('Arial', 15)).place(x=55, y=10, anchor='nw')
    tk.Label(window_about, text='版本0.00', font=('Arial', 15)).place(x=140, y=43, anchor='nw')

    window_about.mainloop()


window = tk.Tk()
window.title('小工具 V0.00')
window.geometry('460x350')
window.geometry('+460+250')
# window.resizable(False, False)

# 重写favicon
tmp = open("favicon.ico", "wb+")
tmp.write(base64.b64decode(favicon))
tmp.close()
window.iconbitmap("favicon.ico")
# 删除临时文件favicon.ico
os.remove("favicon.ico")

menubar = tk.Menu(window)  # 创建一个菜单栏
more_menu = tk.Menu(menubar, tearoff=False)
more_menu.add_command(label='设置', command=setting)
more_menu.add_command(label='帮助', command=help)
more_menu.add_command(label='关于', command=about)
more_menu.add_command(label='检验更新', command=update)
# more_menu.add_command(label='更新日志', command=a)
more_menu.add_separator()  # 添加一条分隔线
more_menu.add_command(label='退出', command=window.quit)
menubar.add_cascade(label='更多', menu=more_menu)
# 显示菜单
window.config(menu=menubar)

# window循环
window.mainloop()
